package com.controller.admin;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.entity.Carpool;
import com.service.CarpoolService;
import com.vo.LayuiPageVo;

@Controller
public class CarpoolController {
	@Autowired 
	private CarpoolService carpoolService;
	/**
     * 后台分页查看合租列表
     * 1.前端传入页码、分页数量
     * 2.查询分页数据
     */
    @ResponseBody
    @GetMapping("/Carpool/queryall")
    public LayuiPageVo queryAllCarpools(int limit, int page) {
        List<Carpool> Carpools = carpoolService.queryAllCarpools((page - 1) * limit, limit);
        Integer dataNumber = carpoolService.LookCarpoolCount();
        return new LayuiPageVo("",0,dataNumber,Carpools);
    }
    /**
     * 后台分页查看合租列表
     * 1.前端传入页码、分页数量
     * 2.查询分页数据
     */
    @ResponseBody
    @GetMapping("/UnCarpool/queryall")
    public LayuiPageVo queryAllUnCarpools(int limit, int page) {
        List<Carpool> Carpools = carpoolService.queryAllUnCarpools((page - 1) * limit, limit);
        Integer dataNumber = carpoolService.LookUnCarpoolCount();
        return new LayuiPageVo("",0,dataNumber,Carpools);
    }
}
